package com.clhbolg.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clhbolg.domain.Article;
import com.clhbolg.domain.vo.ArticleVo;
import com.clhbolg.model.dto.ArticleAdminDTO;
import com.clhbolg.model.dto.ArticleCardDTO;
import com.clhbolg.model.dto.ArticleDTO;
import com.clhbolg.model.dto.ArticleStatisticsDTO;
import com.clhbolg.model.vo.request.ConditionVO;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
import org.apache.poi.ss.formula.functions.T;

import java.util.List;


/**
 * 文章Mapper接口
 *
 * @author cailinhu
 * @date 2023-02-07
 */
@DS("slave")
public interface ArticleMapper extends BaseMapperPlus<ArticleMapper, Article, ArticleVo> {

    Page<ArticleAdminDTO> selectArticleList(@Param("vo") ConditionVO vo,Page<T> page);

    List<ArticleCardDTO> listTopAndFeaturedArticles();

    Page<ArticleCardDTO> userArticleList(@Param("vo") ConditionVO vo,Page<T> page);

    ArticleDTO getArticleById(@Param("id") Long id);

    ArticleCardDTO getPreArticleById(Long id);

    ArticleCardDTO getNextArticleById(Long id);

    /**
     * 查询最后一篇文章
     * @return
     */
    ArticleCardDTO getLastArticle();
    /**
     * 查询第一篇文章
     * @return
     */
    ArticleCardDTO getFirstArticle();

    List<ArticleStatisticsDTO> listArticleStatistics();

    Page<ArticleCardDTO> listArchives(Page<T> build);
}
